Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix head requests #105

Closed
wants to merge 2 commits into from
Closed

Conversation

reneeb
Copy link
Contributor

@reneeb reneeb commented Jan 30, 2019

After an upgrade from version 2.01 to 2.11 I noticed several test failures for HEAD requests in my application. This PR fixes it. A more detailed description is available at reneeb@affb451

With newer version of Mojolicious::Plugin::OpenAPI HEAD requests are broken as no spec
can be found. Hence the default_spec is used - which requires the 'errors' property.
But usually a HEAD request is successful, hence no 'errors' property. This leads to a
'500 Internal Server Error' response.

A HEAD request is some kind of a GET request (it requests the headers that would be
returned if the resource was requested with a GET request. See
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD).

So the HEAD request should be treated as a special case.
@jhthorsen jhthorsen self-requested a review January 30, 2019 11:20
@jhthorsen jhthorsen added the bug label Jan 30, 2019
@reneeb
Copy link
Contributor Author

reneeb commented Feb 4, 2019

Anything I can do?

@jhthorsen
Copy link
Owner

No. I've been traveling, so haven't found time to look at this yet. I just need to see if I should apply your fix or revert my change.

@reneeb
Copy link
Contributor Author

reneeb commented Feb 4, 2019

Ok, I just wanted to ask as you have assigned this PR to me.

BTW: Thanks for all your work!

@jhthorsen jhthorsen closed this in 425e2ef Feb 14, 2019
jhthorsen pushed a commit that referenced this pull request Feb 14, 2019
 - Fix HEAD requests #105
 - Fix using /servers/0/url as basePath for OpenAPI v3 #110
   Note: This could be breaking change
 - Fix getting basePath when using under #107
 - Add support for "nullable" in OpenAPI 3.0 #106
 - Improved handling of Accept header in OpenAPI v3 #104
   Can now handle wildcards, such as application/* and */*, even though not
   defined in the specification.
 - Bump JSON::Validator to 3.06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants